<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>时钟</title>
</head>
<body>
 <div class="d">
     <p>{{ date }}</p>
 </div>

<script src="vue.global.js"></script>
<script>
    const vue =Vue.createApp({
        data() {
            return {
                date:'00:00:00'
            }
        },
        mounted(){
            //定时器,每隔一秒获取一下时间，将时间拼接到date中
            setInterval(()=>{
                let d =new Date();
                this.data=d.getHours()+':'+d.getMinutes()+':'+d.getSeconds();
            },1000);
        }
    }).mount(".d")
</script>
</body>
</html>